<?php
if (isset($param[1])) {
	$slug = amankan($param[1]);
	$blog = db_result("SELECT * FROM blog WHERE slug = '$slug'");
	if ($blog == false) {
		echo "Artikel tidak ditemukan";
	} else {
		echo "<br>".$blog['judul']."<br>";
		echo $blog['tgl']."<br>";
		echo $blog['textform'];
	}
} else {
	$blogs = db_array("SELECT * FROM blog ORDER BY tgl DESC");
	if ($blogs == false) {
		echo "Tidak ada artikel";
	} else {
		foreach ($blogs as $blog) {
			echo "<br>".$blog['judul']."<br>";
			echo substr($blog['textform'],0,10)."... <a href=\"".site()."/".$param[0]."/".$blog['slug']."\">Baca selengkapnya</a><br>";
			echo $blog['tgl']."<br>";
		}
	}
}
?>